package practice.regex;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class SplitText {

  public static void main(String[] args) {

  }

  public static String splitTextIntoWords(String text) {
    //TODO реализуйте метод

    StringBuilder list = new StringBuilder();

    Pattern pattern = Pattern.compile("[a-zA-Z]+");
    Matcher matcher = pattern.matcher(text);

    while (matcher.find()) {
      if (list.length() > 0) {
        list.append(System.lineSeparator());
      }
      list.append(matcher.group());
    }

    return list.toString();
  }

}